package com.student.client.controller;

import com.student.client.entity.Vaccines;
import com.student.client.service.VaccinesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class VaccinesController {
    //查询所有疫苗接种信息记录接口
    @Autowired
    VaccinesService vaccinesService;

    @RequestMapping("/vaccines")
    public List<Vaccines> getvaccines() {
        return vaccinesService.findAllVaccines();
    }
    //添加疫苗接种信息记录接口
    @PostMapping("/addVaccines")
    public Integer getAttendance(@RequestParam String name,
                                 @RequestParam String date,
                                 @RequestParam String location,
                                 @RequestParam String factory,
                                 @RequestParam String place,
                                 @RequestParam String person,
                                 @RequestParam String photo_url,
                                 @RequestParam int age) {
        Vaccines vaccines = new Vaccines(name, date, location, factory, place, person, photo_url, age);
        return vaccinesService.addVaccines(vaccines);
    }
}
